//
// Copyright (C) Microsoft. All rights reserved.  
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not 
// use this file except in compliance with the License.  You may obtain a copy 
// of the License at http://www.apache.org/licenses/LICENSE-2.0  
// 
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
// MERCHANTABLITY OR NON-INFRINGEMENT. 
//
// See the Apache License, Version 2.0 for specific language governing 
// permissions and limitations under the License.
//
//
#include "quad_common.hlsli"

struct pixelShaderInput
{
    float4 point0 : SV_Position;
    float2 uv0 : TEXCOORD;
};

struct pixelShaderOutput
{
    float4 fragment : SV_Target;
};

pixelShaderOutput main(pixelShaderInput p)
{  
    pixelShaderOutput result;
    
    result.fragment.rgb = float3(0, 0, 0);
    result.fragment.a = 1.f;

    // TRACK: 5 is the lasso width, this should come from a constant, same value is hardcoded in quad_renderer
    int offset = context[0];

    if ((uint((p.uv0.x * dimensions.x + offset) / 5) % 2) ||
        (uint((p.uv0.y * dimensions.y) / 5) % 2))
    {
        result.fragment.rgb = float3(1, 1, 1);
        result.fragment.a = alphaValue;
    }

    if (result.fragment.a == 0.f) discard;

    return result;
}
